import _classCallCheck from "@babel/runtime/helpers/esm/classCallCheck";
import _createClass from "@babel/runtime/helpers/esm/createClass";
import _inherits from "@babel/runtime/helpers/esm/inherits";
import _createSuper from "@babel/runtime/helpers/esm/createSuper";
import _applyDecoratedDescriptor from "@babel/runtime/helpers/esm/applyDecoratedDescriptor";

var _dec, _class;

import React from 'react';
import { Col, Row } from 'antd';
import { Bind } from 'lodash-decorators';
import styles from "./Announcement.less?modules";
import newsImg from "../../../assets/cards/news.svg";
import otherImg from "../../../assets/cards/other.svg";
import winningImg from "../../../assets/cards/winning-notice.svg";
import industryImg from "../../../assets/cards/industry-news.svg";
import companyImg from "../../../assets/cards/company-notice.svg";
import businessImg from "../../../assets/cards/business-friend.svg";
import platformImg from "../../../assets/cards/platform-bulletin.svg";
import temporarily from "../../../assets/cards/temporarily-no-data.svg";
var Announcement = (_dec = Bind(), (_class = /*#__PURE__*/function (_React$Component) {
  _inherits(Announcement, _React$Component);

  var _super = _createSuper(Announcement);

  function Announcement() {
    _classCallCheck(this, Announcement);

    return _super.apply(this, arguments);
  }

  _createClass(Announcement, [{
    key: "componentDidMount",
    value: function componentDidMount() {
      var _this$props$handleAnn = this.props.handleAnnouncementList,
          handleAnnouncementList = _this$props$handleAnn === void 0 ? function (e) {
        return e;
      } : _this$props$handleAnn;
      handleAnnouncementList();
    }
    /**
     * 点击跳转详情页
     * @param {number} number
     * @memberof System
     */

  }, {
    key: "handleSkip",
    value: function handleSkip(number) {
      var _this$props$handleDet = this.props.handleDetails,
          handleDetails = _this$props$handleDet === void 0 ? function (e) {
        return e;
      } : _this$props$handleDet;
      handleDetails(number, 'announce');
    }
  }, {
    key: "render",
    value: function render() {
      var _this = this;

      var announcementList = this.props.announcementList;
      var typeObj = {
        PTGG: platformImg,
        GSXW: newsImg,
        HYZX: industryImg,
        QTGG: otherImg,
        XPZJ: businessImg,
        SYQ: businessImg,
        GSWD: companyImg,
        GSTZ: companyImg,
        GSZD: companyImg,
        ZBYG: winningImg,
        ZBGG: winningImg,
        ZBCQ: winningImg,
        XJTZ: winningImg,
        BJTZ: winningImg
      };

      if (announcementList.length) {
        return /*#__PURE__*/React.createElement("div", {
          className: styles['notice-list-wrap']
        }, announcementList.map(function (item) {
          return /*#__PURE__*/React.createElement(Row, {
            key: item.noticeId,
            type: "flex",
            justify: "space-around",
            align: "middle",
            className: styles['notice-row'],
            onClick: function onClick() {
              return _this.handleSkip(item.noticeId);
            }
          }, /*#__PURE__*/React.createElement(Col, {
            span: 2,
            className: styles['notice-type']
          }, /*#__PURE__*/React.createElement("img", {
            alt: "",
            src: typeObj[item.noticeTypeCode],
            className: styles['notice-img']
          })), /*#__PURE__*/React.createElement(Col, {
            span: 22,
            className: styles['notice-content']
          }, /*#__PURE__*/React.createElement(Row, {
            style: {
              marginBottom: '4px'
            }
          }, /*#__PURE__*/React.createElement(Col, {
            span: 16,
            className: styles['notice-title']
          }, item.title), /*#__PURE__*/React.createElement(Col, {
            span: 8,
            className: styles['notice-time']
          }, item.publishedDateTimeStr)), item.noticeContent && item.noticeContent.noticeBody && /*#__PURE__*/React.createElement(Col, {
            className: styles['notice-list'],
            dangerouslySetInnerHTML: {
              __html: item.noticeContent.noticeBody
            }
          })));
        }));
      } else {
        return /*#__PURE__*/React.createElement("div", {
          className: styles['notice-img-wrap']
        }, /*#__PURE__*/React.createElement("img", {
          src: temporarily,
          alt: "",
          className: styles['notice-no-img']
        }));
      }
    }
  }]);

  return Announcement;
}(React.Component), (_applyDecoratedDescriptor(_class.prototype, "handleSkip", [_dec], Object.getOwnPropertyDescriptor(_class.prototype, "handleSkip"), _class.prototype)), _class));
export { Announcement as default };